import request from '@/util/request'
import { dealOpts, FIRM, USER, FIRM_STAFF } from './../api_type'

// role
const firmGetRole = (params, opts) => {
  return request.get(dealOpts(FIRM + '/getRoles', opts), params)
}

const firmCreateRole = (params, opts) => {
  return request.post(dealOpts(FIRM + '/createRole', opts), params)
}

const firmUpdateRole = (params, opts) => {
  return request.post(dealOpts(FIRM + '/modifyRole', opts), params)
}

const firmDeleteRole = (params, opts) => {
  return request.get(dealOpts(FIRM + '/deleteRole', opts), params)
}

const firmGetRights = (params, opts) => {
  return request.get(dealOpts(FIRM_STAFF + '/getRights', opts), params)
}

const firmUpdateRights = (params, opts) => {
  return request.get(dealOpts(USER + '/updateRights', opts), params)
}

const firmGetRoleRights = (params, opts) => {
  return request.get(dealOpts(USER + '/getRoleRights', opts), params)
}

const firmGetRolestaffs = (params, opts) => {
  return request.get(dealOpts(FIRM + '/getRoleStaffs', opts), params)
}

const firmAddRoleStaff = (params, opts) => {
  return request.get(dealOpts(FIRM + '/addRoleStaff', opts), params)
}

const firmDeleteRoleStaff = (params, opts) => {
  return request.get(dealOpts(FIRM + '/deleteRoleStaff', opts), params)
}

export default {
  // role
  firmGetRole,
  firmCreateRole,
  firmUpdateRole,
  firmDeleteRole,
  firmGetRights,
  firmUpdateRights,
  firmGetRoleRights,
  firmGetRolestaffs,
  firmAddRoleStaff,
  firmDeleteRoleStaff
}
